﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Diagnostics;

namespace ESAM_Assignment_3
{
    public partial class Error : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            lblError.Text = "We apologize, you have encountered an error."; // default error message

            int errorCode;
            string errorQuery = HttpUtility.UrlDecode(Request.QueryString["errorCode"]);
            if (errorQuery != null)
            {
                if (int.TryParse(errorQuery, out errorCode))
                {
                    switch (errorCode)
                    {
                        case 0:
                            lblError.Text = "Sorry, the page does not exist!";
                            break;
                        case 1:
                            lblError.Text = "A runtime error was encountered. We will look into the problem as soon as possible. Sorry for the inconvenience.";
                            break;
                    }
                }
            }
        }
    }
}